﻿Class friends
    Private Class _Friend
        Private AvatarUrlValue As String
        Public Property AvatarUrl() As String
            Get
                Return AvatarUrlValue
            End Get
            Set(ByVal value As String)
                AvatarUrlValue = value
            End Set
        End Property

        Private NameValue As String
        Public Property Name() As String
            Get
                Return NameValue
            End Get
            Set(ByVal value As String)
                NameValue = value
            End Set
        End Property
        Private MedalValue As String
        Public Property Medal() As String
            Get
                Return MedalValue
            End Get
            Set(ByVal value As String)
                MedalValue = value
            End Set
        End Property

    End Class
    Private Async Function Update(Optional page As Integer = 1) As Task
        Dim a = Await SpacesPost("http://spaces.ru/friends/?name=Kryeker&sort=1" & "&p=" & page)
        Dim b = Split(a, "list_item small_gradient bookmark_block").Skip(1)
        Dim temp As _Friend, s As Integer
        For Each i In b
            temp = New _Friend
            temp.AvatarUrl = Split(Split(i, "src=""")(1), """")(0)
            temp.Name = Split(Split(i, "http://spaces.ru/mysite/?name=")(1), """")(0)
            s = InStr(i, "http://i.spaces.ru//medal")
            If s > 0 Then temp.Medal = Split(Mid(i, s), """")(0)
            List3.Items.Add(temp)
        Next
    End Function

    Private Async Sub Page_Loaded_1(sender As Object, e As RoutedEventArgs)
        Await Update()
    End Sub
End Class
